from django.contrib import admin
from .models import Antique, AntiqueImage

class AntiqueImageInline(admin.TabularInline):
    model = AntiqueImage
    extra = 3

@admin.register(Antique)
class AntiqueAdmin(admin.ModelAdmin):
    list_display = ('name', 'number', 'dynasty', 'process', 'shape', 'kiln', 'price', 'condition', 'order', 'created_at')
    list_filter = ('dynasty', 'process', 'shape', 'kiln', 'condition')
    search_fields = ('name', 'number', 'description')
    date_hierarchy = 'created_at'
    inlines = [AntiqueImageInline]
    ordering = ['order', '-created_at']
    list_editable = ['order']
